// 该文件负责所有的公共组件的全局注册
// vue插件机制: Vue.use

import PageTools from '@/components/PageTools'
import ImageUpload from '@/components/ImageUpload'
import store from '@/store'
import ScreenFull from '@/components/ScreenFull'
import lang from './lang'
import TagsView from '@/components/TagsView'
import ThemePicker from './ThemePicker'

export default {
  // 插件的初始化, 插件给你提供的全局的功能, 都可以在这里配置
  install(Vue) {
    Vue.component(PageTools.name, PageTools)
    Vue.component(ImageUpload.name, ImageUpload)
    Vue.component(ScreenFull.name, ScreenFull)
    Vue.component(lang.name, lang)
    Vue.component(TagsView.name, TagsView)
    Vue.component(ThemePicker.name, ThemePicker)

    Vue.prototype.$aa = function() {
      console.log('哈哈')
    }
    Vue.prototype.check = function(point) {
      // 如果point在权限中，那这个按钮就应该显示出来
      // if (store.state.user.userInfo.roles.points) {
      //   return false
      // }
      return store.state.user.userInfo.roles?.points.some(item => item.toLowerCase() === point.toLowerCase())
      // console.log(points)
    }
  }
}
